package com.haotunet.app.goldtreasure.utils;

import android.text.TextUtils;

/**
 * Created by xiaoshuyong on 2017/4/18.
 */

public class StringConvertNumber {


    public static double parseDouble(String doubleString) {
        double number = 0.00;
        if (!TextUtils.isEmpty(doubleString)) {
            try {
                number = Double.parseDouble(doubleString);
            } catch (NumberFormatException e) {
                e.printStackTrace();
            }
        }
        return number;
    }

    public static int parseInt(String intString) {
        int number = 0;
        if (!TextUtils.isEmpty(intString)) {
            try {
                number = Integer.parseInt(intString);
            } catch (NumberFormatException e) {
                e.printStackTrace();
            }
        }
        return number;
    }


    public static float parseFloat(String floatString) {
        float number = 0.00f;
        if (!TextUtils.isEmpty(floatString)) {
            try {
                number = Float.parseFloat(floatString);
            } catch (NumberFormatException e) {
                e.printStackTrace();
            }
        }
        return number;
    }
}
